//
//  JWSDtabcell.m
//  test
//
//  Created by 李彦宏 on 2018/3/16.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "JWSDtabcell.h"

@implementation JWSDtabcell


//类方法快速创建cell
+(instancetype)cellwithTableview:(UITableView *)tableview{
    
    // 1.创建cell
    static NSString *ID = @"cell113";
    JWSDtabcell *cell = [tableview dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[JWSDtabcell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return  cell;
    
}
/**
 *  cell的初始化方法，一个cell只会调用一次
 *  一般在这里添加所有可能显示的子控件，以及子控件的一次性设置
 */
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //添加UI控件
        [self setcellUI];
    }
    return self;
}
-(void)setcellUI{
#pragma -mark ———————————学员cell————————————————————
    UILabel *lb2=[[UILabel alloc] init];
    [lb2 setBackgroundColor:[UIColor clearColor]];
    [lb2 setTextColor:[UIColor blackColor]];
    [lb2 setFont:[UIFont systemFontOfSize:14]];
    lb2.textAlignment=NSTextAlignmentCenter;
    lb2.text=@"史蒂芬金";
    self.SnameLb=lb2;
    [self.contentView addSubview:lb2];
    lb2.frame = CGRectMake(0, 7, 75, 30);
    
    UILabel *lb3=[[UILabel alloc] init];
    [lb3 setBackgroundColor:[UIColor clearColor]];
    [lb3 setTextColor:[UIColor blackColor]];
    [lb3 setFont:[UIFont systemFontOfSize:14]];
    lb3.textAlignment=NSTextAlignmentCenter;
    lb3.text=@"15111111111";
    [self.contentView addSubview:lb3];
    self.PhoneLb=lb3;
    lb3.frame = CGRectMake(70, 7, (ScreenWidth-120)/2, 30);
    
    UILabel *lb4=[[UILabel alloc] init];
    [lb4 setBackgroundColor:[UIColor clearColor]];
    [lb4 setTextColor:[UIColor blackColor]];
    [lb4 setFont:[UIFont systemFontOfSize:14]];
    lb4.textAlignment=NSTextAlignmentCenter;
    lb4.text=@"爱因斯坦";
    self.GnameLb=lb4;
    [self.contentView addSubview:lb4];
    lb4.frame = CGRectMake(60+(ScreenWidth-120)/2, 7, (ScreenWidth-120)/2, 30);
    
    UILabel *lb5=[[UILabel alloc] init];
    [lb5 setBackgroundColor:[UIColor clearColor]];
    [lb5 setTextColor:XGColor];
    [lb5 setFont:[UIFont systemFontOfSize:14]];
    lb5.textAlignment=NSTextAlignmentCenter;
    lb5.text=@"否";
    self.XieyiLb=lb5;
    [self.contentView addSubview:lb5];
    lb5.frame = CGRectMake(ScreenWidth-70, 7, 60, 30);
    
    UILabel *lb6=[[UILabel alloc] init];
    [lb6 setBackgroundColor:[UIColor clearColor]];
    [lb6 setTextColor:[UIColor lightGrayColor]];
    [lb6 setFont:[UIFont systemFontOfSize:16]];
    lb6.textAlignment=NSTextAlignmentLeft;
    lb6.text=@">";
    [self.contentView addSubview:lb6];
    lb6.frame = CGRectMake(ScreenWidth-15,6 , 10, 30);
    
}

-(void)setModel:(SDUserModel *)model{
    _model=model;
    self.SnameLb.text=_model.name;
    self.GnameLb.text=_model.Gname;
    self.PhoneLb.text=_model.phone;
    if([_model.xieyi isEqualToString:@"0"]){
        self.XieyiLb.text=@"否";
        self.XieyiLb.textColor=XGColor;
    }else{
        self.XieyiLb.text=@"是";
        self.XieyiLb.textColor=[UIColor blackColor];
    }
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
